package common;

import java.util.HashMap;

import javax.swing.JPanel;
import javax.swing.JProgressBar;

import org.w3c.dom.Element;

import fitness.AmplyFitness;
import fitness.Fitness;
import fitness.PulseFitness;

import optimizers.commons.RunConfig;
import optimizers.ganeat.Constants;
import optimizers.ganeat.GA;
import optimizers.ganeat.amplify.ConstantsAmply;
import optimizers.ganeat.amplify.GAAmplify;
import optimizers.ganeat.math.ConstantsMath;
import optimizers.ganeat.math.GAMath;
import optimizers.ganeat.pulsegenerator.GAPulse;
import optimizers.ganeat.sin.ConstantsSin;

public class RunPulse extends RunStarter {

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return "PulseGenerator";
	}

	@Override
	public void start() {
		runStatus.status = runStatus.RUNNING;
		for (int i = 0; i < Constants.nRuns; i++) {
			GAPulse ga = (GAPulse) getGA();
			try {
				ga.start();
			} catch (CloneNotSupportedException | InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	@Override
	public Fitness getFitnessFunction() {
		return new PulseFitness();
	}

	@Override
	public HashMap<String, String> getDefaultParameters() {
		// TODO Auto-generated method stub
		return new HashMap();
	}

	@Override
	public void setParameters(HashMap<String, String> parameters) {

	}

	@Override
	public GA getGA() {
		// TODO Auto-generated method stub
		return new GAPulse(config, initIndiv, panelFitness, panelSpecies,
				panelIndiv, runStatus, progressBar, fitnessElement);
	}

}
